home *** CD-ROM | disk | FTP | other *** search
- Path: sun630.bentley.com!usenet
- From: Philip McGraw <Philip.McGraw@Bentley.com>
- Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.win32
- Subject: Re: VC++ 4.0 memory allocation slower than in 2.x!!!
- Date: Fri, 29 Mar 1996 15:52:48 -0500
- Organization: Bentley Systems
- Message-ID: <315C4DA0.30C@Bentley.com>
- References: <alanDozpsy.Kn6@netcom.com>
- NNTP-Posting-Host: dhcp6243.bentley.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0GoldB1 (WinNT; I)
-
- Robert Alan Wright wrote:
-
- > I recently posted a request for help in determining why a program which
- > was simply recompiled on VC++4.0 suddenly ran 3 times slower than the
- > same one did under VC++ 2.0.
-
- > I went through all the usual steps of making sure that I had the right
- > compiler/link settings and even built my own version of the MFC
- > libraries to make sure they were fully optimized.
-
- > Upon further profiling and other exploration, I found out the problem:
- > THE VC++ 4.0 MEMORY ALLOCATION ROUTINES ARE WAY SLOWER!!!
-
- The VC 4.0 C runtime libraries use HeapAlloc and HeapFree instead of the suballocation from
- VirtualAlloc'ed memory that was used in VC 2.x. You can rebuild the VC 4.0 runtime libraries to
- use the old scheme by setting WINHEAP = NO on line 78 of the makefile (and also changing the lib
- and dll names on lines 19-22 from _sample_ to msvcrt40 and _sampld_ to msvcr40d). I'd be
- interested in hearing how much this speeds up your program's performance. Of course, you cannot
- ship modified DLLs with the same name as the standard ones, but this is just an experiment anyway.
-
- > I don't understand how this can be, but I switched from using the
- > Microsoft malloc/realloc routines to my own versions, and now I
- > get about the same performance from the app that I used to.
-
- Did you use a suballocation scheme similar to the one used by the VC 2.0 library?
-
- > As best I can tell, the new realloc routine is about 10 TIMES SLOWER
- > than the old one, and malloc is also slower. At this point, I
- > have replaced the use of almost all Microsoft MFC classes as well as
- > C/C++ runtime routines in order to get decent performance. I am quite
- > disgusted in the apparent low quality of their implementations.
-
- > Can anyone offer any more rational explanation for this than that
- > Microsoft has horrible quality control? I'm having a hard time
- > believing they could do screw up this badly.
-
- The only explanation I can think of is that the Win32 heap routines might have been considered more
- reliable or debuggable than the runtime suballocation routines. Or, they may have just decided to
- let the operating system handle something that the C runtime used to handle. I have noticed that
- the default allocator for OLE appears to be these same Win32 heap routines. Maybe that enters into
- their decision also?
-
- Philip McGraw
-